package engine.util.collada;

import engine.material.Material;

public class ColladaMaterial {
	
	private String id;
	private float[] ambient;
	private float[] diffuse;
	private float[] specular;
	private float[] emission;
	private float shininess;
	
	private ColladaTexture texture;
	
	private ColladaMaterial(String id, float[] ambient, float[] diffuse, float[] specular, float[] emission, float shininess) {
		this.id = id;
		
		if(ambient != null) {
			this.ambient = ambient;
		} else {
			this.ambient = new float[]{0, 0, 0, 1};
		}
		
		if(diffuse != null) {
			this.diffuse = diffuse;
		} else {
			this.diffuse = new float[]{0, 0, 0, 1};
		}
		
		if(specular != null) {
			this.specular = specular;
		} else {
			this.specular = new float[]{0, 0, 0, 1};
		}
		
		if(emission != null) {
			this.emission = emission;
		} else {
			this.emission = new float[]{0, 0, 0, 1};
		}
		
		this.shininess = shininess;
	}
	
	public ColladaMaterial(String id, float[] ambient, float[] diffuse, float[] specular, float[] emission, float shininess, ColladaTexture texture) {
		this(id, ambient, diffuse, specular, emission, shininess);
		
		this.texture = texture;
	}
	
	public String getId() {
		return id;
	}
	
	protected void setId(String id) {
		this.id = id;
	}
	
	public Material toMaterial() {
		return new Material(ambient, diffuse, specular, emission, shininess);
	}
	
	public ColladaTexture getTexture() {
		return texture;
	}
}
